﻿using System;
using System.Collections.Generic;
using System.Text;
using NetworkLib.Utilities;

namespace PokemonBattle.BattleNetwork
{
    public enum BattleMove : int
    {
        Attack = 868794430,
        SwapPokemon = -762866655,
        DeathSwap = -532471963,
        PassSwap = -1116926315,
        WrongInput = -1
    }

    public static class BattleMoveHelper
    {

        public static BattleMove ReadFromByteArray(ByteArray byteArray)
        {
            int val = byteArray.ReadInt();
            return Parse(val);
        }

        public static BattleMove Parse(int val)
        {
            foreach (int value in Enum.GetValues(typeof(BattleMove)))
            {
                if (value == val) return (BattleMove)value;
            }
            return BattleMove.WrongInput;
        }

        public static void WriteToByteArray(ByteArray byteArray, BattleMove value)
        {
            byteArray.WriteInt((int)value);
        }
    }
}
